package com.caipin.service.impl;


import com.caipin.dao.MobileDao;
import com.caipin.domain.Mobile;
import com.caipin.service.MobileService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @Author: zhunian0322@163.com
 * @DateTime: 2020-03-14 10:19
 * @Description: TODO
 */
@Service
@Slf4j
public class MobileServiceImpl implements MobileService {

    @Autowired
    private MobileDao mobileDao;

    @Override
    @Cacheable(value = "mobileInfo", key = "'mobile'+#p0")
    public Mobile findByMobile(String mobile) {
        if (StringUtils.isEmpty(mobile)) {
            return null;
        }

        log.info("findByMobile " + mobile);
        return mobileDao.findByMobile(mobile);
    }
}
